home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / Processes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  6.0 KB  |  227 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Processes.h
  3.  
  4.      Contains:    Process Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1989-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __PROCESSES__
  18. #define __PROCESSES__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __EVENTS__
  24. #include <Events.h>
  25. #endif
  26. #ifndef __FILES__
  27. #include <Files.h>
  28. #endif
  29.  
  30.  
  31.  
  32. #if PRAGMA_ONCE
  33. #pragma once
  34. #endif
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43.  
  44. #if PRAGMA_STRUCT_ALIGN
  45.     #pragma options align=mac68k
  46. #elif PRAGMA_STRUCT_PACKPUSH
  47.     #pragma pack(push, 2)
  48. #elif PRAGMA_STRUCT_PACK
  49.     #pragma pack(2)
  50. #endif
  51.  
  52. /* type for unique process identifier */
  53.  
  54. struct ProcessSerialNumber {
  55.     unsigned long                     highLongOfPSN;
  56.     unsigned long                     lowLongOfPSN;
  57. };
  58. typedef struct ProcessSerialNumber        ProcessSerialNumber;
  59. typedef ProcessSerialNumber *            ProcessSerialNumberPtr;
  60.  
  61. enum {
  62.                                                                 /* Process identifier - Various reserved process serial numbers */
  63.     kNoProcess                    = 0,
  64.     kSystemProcess                = 1,
  65.     kCurrentProcess                = 2
  66. };
  67.  
  68. /* Definition of the parameter block passed to _Launch */
  69. /* Typedef and flags for launchControlFlags field*/
  70.  
  71. typedef unsigned short                     LaunchFlags;
  72.  
  73. enum {
  74.     launchContinue                = 0x4000,
  75.     launchNoFileFlags            = 0x0800,
  76.     launchUseMinimum            = 0x0400,
  77.     launchDontSwitch            = 0x0200,
  78.     launchAllow24Bit            = 0x0100,
  79.     launchInhibitDaemon            = 0x0080
  80. };
  81.  
  82. /* Format for first AppleEvent to pass to new process.  The size of the overall
  83.   buffer variable: the message body immediately follows the messageLength */
  84.  
  85. struct AppParameters {
  86.     EventRecord                     theMsgEvent;
  87.     unsigned long                     eventRefCon;
  88.     unsigned long                     messageLength;
  89. };
  90. typedef struct AppParameters            AppParameters;
  91. typedef AppParameters *                    AppParametersPtr;
  92. /* Parameter block to _Launch */
  93.  
  94. struct LaunchParamBlockRec {
  95.     unsigned long                     reserved1;
  96.     unsigned short                     reserved2;
  97.     unsigned short                     launchBlockID;
  98.     unsigned long                     launchEPBLength;
  99.     unsigned short                     launchFileFlags;
  100.     LaunchFlags                     launchControlFlags;
  101.     FSSpecPtr                         launchAppSpec;
  102.     ProcessSerialNumber             launchProcessSN;
  103.     unsigned long                     launchPreferredSize;
  104.     unsigned long                     launchMinimumSize;
  105.     unsigned long                     launchAvailableSize;
  106.     AppParametersPtr                 launchAppParameters;
  107. };
  108. typedef struct LaunchParamBlockRec        LaunchParamBlockRec;
  109.  
  110. typedef LaunchParamBlockRec *            LaunchPBPtr;
  111. /* Set launchBlockID to extendedBlock to specify that extensions exist.
  112.  Set launchEPBLength to extendedBlockLen for compatibility.*/
  113.  
  114. enum {
  115.     extendedBlock                = 0x4C43,                        /* 'LC' */
  116.     extendedBlockLen            = sizeof(LaunchParamBlockRec) - 12
  117. };
  118.  
  119.  
  120. enum {
  121.                                                                 /* Definition of the information block returned by GetProcessInformation */
  122.     modeLaunchDontSwitch        = 0x00040000,
  123.     modeDeskAccessory            = 0x00020000,
  124.     modeMultiLaunch                = 0x00010000,
  125.     modeNeedSuspendResume        = 0x00004000,
  126.     modeCanBackground            = 0x00001000,
  127.     modeDoesActivateOnFGSwitch    = 0x00000800,
  128.     modeOnlyBackground            = 0x00000400,
  129.     modeGetFrontClicks            = 0x00000200,
  130.     modeGetAppDiedMsg            = 0x00000100,
  131.     mode32BitCompatible            = 0x00000080,
  132.     modeHighLevelEventAware        = 0x00000040,
  133.     modeLocalAndRemoteHLEvents    = 0x00000020,
  134.     modeStationeryAware            = 0x00000010,
  135.     modeUseTextEditServices        = 0x00000008,
  136.     modeDisplayManagerAware        = 0x00000004,
  137.     modeGuardPageAware            = 0x00000002
  138. };
  139.  
  140. /* Record returned by GetProcessInformation */
  141.  
  142. struct ProcessInfoRec {
  143.     unsigned long                     processInfoLength;
  144.     StringPtr                         processName;
  145.     ProcessSerialNumber             processNumber;
  146.     unsigned long                     processType;
  147.     OSType                             processSignature;
  148.     unsigned long                     processMode;
  149.     Ptr                             processLocation;
  150.     unsigned long                     processSize;
  151.     unsigned long                     processFreeMem;
  152.     ProcessSerialNumber             processLauncher;
  153.     unsigned long                     processLaunchDate;
  154.     unsigned long                     processActiveTime;
  155.     FSSpecPtr                         processAppSpec;
  156. };
  157. typedef struct ProcessInfoRec            ProcessInfoRec;
  158. typedef ProcessInfoRec *                ProcessInfoRecPtr;
  159.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  160.                                                                                             #pragma parameter __D0 LaunchApplication(__A0)
  161.                                                                                             #endif
  162. EXTERN_API( OSErr )
  163. LaunchApplication                (LaunchPBPtr             LaunchParams)                        ONEWORDINLINE(0xA9F2);
  164.  
  165. EXTERN_API( OSErr )
  166. LaunchDeskAccessory                (const FSSpec *            pFileSpec,
  167.                                  ConstStr255Param         pDAName)                            THREEWORDINLINE(0x3F3C, 0x0036, 0xA88F);
  168.  
  169. #if TARGET_OS_MAC
  170.     #define MacGetCurrentProcess GetCurrentProcess
  171. #endif
  172. EXTERN_API( OSErr )
  173. MacGetCurrentProcess            (ProcessSerialNumber *    PSN)                                THREEWORDINLINE(0x3F3C, 0x0037, 0xA88F);
  174.  
  175. EXTERN_API( OSErr )
  176. GetFrontProcess                    (ProcessSerialNumber *    PSN)                                FIVEWORDINLINE(0x70FF, 0x2F00, 0x3F3C, 0x0039, 0xA88F);
  177.  
  178. EXTERN_API( OSErr )
  179. GetNextProcess                    (ProcessSerialNumber *    PSN)                                THREEWORDINLINE(0x3F3C, 0x0038, 0xA88F);
  180.  
  181. EXTERN_API( OSErr )
  182. GetProcessInformation            (const ProcessSerialNumber * PSN,
  183.                                  ProcessInfoRec *        info)                                THREEWORDINLINE(0x3F3C, 0x003A, 0xA88F);
  184.  
  185. EXTERN_API( OSErr )
  186. SetFrontProcess                    (const ProcessSerialNumber * PSN)                            THREEWORDINLINE(0x3F3C, 0x003B, 0xA88F);
  187.  
  188. EXTERN_API( OSErr )
  189. WakeUpProcess                    (const ProcessSerialNumber * PSN)                            THREEWORDINLINE(0x3F3C, 0x003C, 0xA88F);
  190.  
  191. EXTERN_API( OSErr )
  192. SameProcess                        (const ProcessSerialNumber * PSN1,
  193.                                  const ProcessSerialNumber * PSN2,
  194.                                  Boolean *                result)                                THREEWORDINLINE(0x3F3C, 0x003D, 0xA88F);
  195.  
  196. #if !OLDROUTINELOCATIONS
  197. /*
  198.     ExitToShell was previously in SegLoad.h
  199. */
  200. EXTERN_API( void )
  201. ExitToShell                        (void)                                                        ONEWORDINLINE(0xA9F4);
  202.  
  203. #endif  /* !OLDROUTINELOCATIONS */
  204.  
  205.  
  206.  
  207. #if PRAGMA_STRUCT_ALIGN
  208.     #pragma options align=reset
  209. #elif PRAGMA_STRUCT_PACKPUSH
  210.     #pragma pack(pop)
  211. #elif PRAGMA_STRUCT_PACK
  212.     #pragma pack()
  213. #endif
  214.  
  215. #ifdef PRAGMA_IMPORT_OFF
  216. #pragma import off
  217. #elif PRAGMA_IMPORT
  218. #pragma import reset
  219. #endif
  220.  
  221. #ifdef __cplusplus
  222. }
  223. #endif
  224.  
  225. #endif /* __PROCESSES__ */
  226.  
  227.